package com.xncoding.pos.init;

import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * JacksonUtils工具类
 *
 * @Author guoyb
 * @Date 2020/1/15  14:38
 */
@Slf4j
@Component
public class MyTestUtils {


    /**
     * javaBean、列表数组转换为json字符串
     */
    public static String obj2json(Object obj) throws Exception {

        log.info("channel-----打印日志------{}", channel);
        return JSONUtil.toJsonStr(obj);
    }

    //静态属性
    private static String channel;

    @Value("${config.channel}")
    public void setUploadPath(String uploadPath) {
        MyTestUtils.channel = uploadPath;
    }
}
